#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int n;
int a[N], temp[N];

int find(int x) {
	int l = 0, r =  n - 1;
	int mid = l + r >> 1;
	while (l < r) {
		if (a[mid] >= x) {
			r = mid;
		} else {
			l = mid + 1;
		}
	}
	return r + 1;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		temp[i] = a[i];
	}
	sort(a, a + n);
	reverse(a, a + n);
	long long sum = 0;
	for (int i = 0; i < n; ++i) {
		sum += a[i] * i;
	}

	for (int i = 0; i < n; ++i) {
		//temp[i] = find(temp[i]);
		cout << a[i] << ' ';
	}
	cout << endl;
	double res = 1.0 * sum / n;
	printf("%.2f", res);
	return 0;
}